<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@include file="/WEB-INF/pages/common/common.jsp"%>
<title>用户列表</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.STYLE1 {
	width:60%;
	font-size: 14px; 
	height:20px;
	margin: 10px 20%;
}
.da_style{
width:100%;
	font-size: 14px; border:solid 1px red;
	margin: 10px 0px 10px 0px;
	float: left;}
.stylte3{
	width:15%;
	float:left;
	margin-right:8px;
	text-align:right; }
.stylte2{
	float:left;
	width:80%;
	
	text-align:left;}

.STYLE4 {
	font-size: 12px;
	color: #1F4A65;
	font-weight: bold;
}

a:link {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}

a:visited {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}

a:hover {
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}

a:active {
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}

.STYLE7 {
	font-size: 12
}
-->
</style>
</head>
<script type="text/javascript">
var error="<img src='${ctx}resources/images/exist.png'/>";
var succ = "<img src='${ctx}resources/images/noexist.png'/>";
$(function(){
	$("#datepicker").attr("readonly", "true").datepicker(); 
});

function checkFrom(){
	if(checkRealName()&&checkLoginName()&&checkEmail()&&checkPwd()&&checkRepwd()){
		$("#addForm").submit();
	}
	
}

function checkRealName(){
	var realName = $.trim($("#realName").val());
	if(realName==null||realName.length<2){
		$("#realNameTip").html(error+"<font  style='color: red'>姓名长度不能少于两个字符!</font>");
		return false;
	}
	$("#realNameTip").html(succ+"姓名填写正确!");
	return true;
}
function checkLoginName(){
	var loginName = $.trim($("#loginName").val());
	if(loginName==null||loginName.length<4){
		$("#loginNameTip").html(error+"<font  style='color: red'>用户名长度不能少于4个字符!</font>");
		return false;
	}
	$("#loginNameTip").html(succ+"用户名填写正确!");
	return true;
}
function checkEmail(){
	var email = $.trim($("#email").val());
	var search = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
	if(email==null||!search.test(email)){
		$("#emailTip").html(error+"<font  style='color: red'>email格式不正确!</font>");
		return false;
	}
	$("#emailTip").html(succ+"email填写正确!");
	return true;
}
function checkPwd(){
	var pwd = $.trim($("#pwd").val());
	if(pwd==null||pwd.length<6){
		$("#pawdTip").html(error+"<font  style='color: red'>密码长度不能少于6个字符!</font>");
		return false;
	}
	$("#pawdTip").html(succ+"密码填写正确!");
	return true;
}
function checkRepwd(){
	var repwd = $.trim($("#repwd").val());
	var pwd = $.trim($("#pwd").val());
	if(repwd==null||repwd.length<6){
		$("#repwdTip").html(error+"<font  style='color: red'>确认密码长度不能少于6个字符!</font>");
		return false;
	}
	if(repwd!=pwd){
		$("#repwdTip").html(error+"<font  style='color: red'>密码与确认密码不一致!</font>");
		return false;
	}
	$("#repwdTip").html(succ+"确认密码填写正确!");
	return true;
}
</script>
<body>
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td height="30">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="15" height="30">
								<img src="${ctx}resources/images/page/tab_03.gif" width="15" height="30" />
							</td>
							<td width="1101" background="${ctx}resources/images/page/tab_05.gif">
								<img src="${ctx}resources/images/page/311.gif" width="16" height="16" />
								<span class="STYLE4">${user==null?"添加":"修改"}用户</span>
							</td>
							
							<td width="14">
								<img src="${ctx}resources/images/page/tab_07.gif" width="14" height="30" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="9" background="${ctx}resources/images/page/tab_12.gif">&nbsp;</td>
							<td bgcolor="#f3ffe3">
								<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#c0de98">
								<form id="addForm" action="${ctx}/user/save.htm" method="post">
									<input type="hidden" name="user.id" value="${user.id}">
									<tr >
										<td height="18" bgcolor="#FFFFFF" width="100%" style="border-right-color: #ffffff ">
											<div align="center" class="STYLE1">
												<div class="stylte3">
												<span style="color:red">*</span> 姓&nbsp;名 :</div>
												<div class="stylte2">
													<input style="width:260px" name="user.realName" id="realName" value="${user.realName}" onblur="checkRealName()">
													<span id="realNameTip"></span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF" width="100%" style="border-right-color: #ffffff ">
											<div align="center" class="STYLE1">
												<div class="stylte3">
												<span style="color:red;">*</span> 用户名 :</div>
												<div class="stylte2">
													<input style="width:260px" name="user.loginName" id="loginName" value="${user.loginName}" onblur="checkLoginName()">
													<span id="loginNameTip">${verifyName==null?"":verifyName}</span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3"><span style="color:red">*</span>E-Mail :</div>
												<div class="stylte2"><input style="width:260px" id="email" name="user.email" onblur="checkEmail()" value="${user.email}">
													<span id="emailTip">${verifyEmail==null?"":verifyEmail}</span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span style="color:red">*</span>密码 :
												</div>
												<div class="stylte2">
													<input style="width:260px" type="password" id="pwd" name="user.pawd" onblur="checkPwd()">
													<span id="pawdTip"></span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span style="color:red">*</span>确认密码 :
												</div>
												<div class="stylte2">
													<input style="width:260px" name="repwd" id="repwd" type="password" onblur="checkRepwd()">
													<span id="repwdTip"></span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span style="color:red">*</span>性别 :
												</div>
												<div class="stylte2">
													<input type="radio" name="user.sex"  value="0" ${user==null?"checked": user.sex=="0"?"checked":""}>男
													<input type="radio" name="user.sex" value="1" ${user.sex=="1"?"checked":""} >女
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
											<div class="stylte3">
												<span>*</span>手机 :
											 </div>
											<div class="stylte2">
												<input style="width:260px" name="user.mobile" value="${user.mobile}">
												<span id="mobile_span"></span>
											</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span>*</span>联系电话 : 
												</div>
												<div class="stylte2">
													<input style="width:260px" name="user.phone" value="${user.phone}">
													<span> </span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3"><span>*</span>生日: 
												</div>
												<div class="stylte2">
													<input class="datepicker" id="datepicker" name="user.bithday" style="width:260px" value="<fmt:formatDate value='${user.bithday}' pattern= 'yyyy-MM-dd'/>">
													<span></span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span></span>住址:</div>
												<div class="stylte2">
													<input style="width:260px" name="user.addr" value="${user.addr}">
													<span></span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span></span>学历:
												</div>
												<div class="stylte2">
													<select style="width:160px;height: 18px" name="user.edu">
														<option value="博士" ${user.edu=="博士"?"selected":""}>博士</option>
														<option value="硕士" ${user.edu=="硕士"?"selected":""}>硕士</option>
														<option value="本科" ${user.edu=="本科"?"selected":""}>本科</option>
														<option value="大专" ${user.edu=="大专"?"selected":""}>大专</option>
														<option value="中专" ${user.edu=="中专"?"selected":""}>中专</option>
														<option value="高中" ${user.edu=="高中"?"selected":""}>高中</option>
														<option value="初中" ${user.edu=="初中"?"selected":""}>初中</option>
														<option value="小学" ${user.edu=="小学"?"selected":""}>小学</option>
													</select>
													<span></span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span style="color:red">*</span>状态:
												</div>
												<div class="stylte2">
													<input type="radio" name="user.status" ${user==null?"checked": user.status=="0"?"checked":""} value="0"/>正常<input type="radio" name="user.status" ${user.status=="1"?"checked":""} value="1">无效
													<span></span>
												</div> 
											</div>
										</td>
									</tr>
									<tr >
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span style="color:red">*</span>部门 :</div>
												<div class="stylte2" style="padding-bottom: 10px;"><br/>
													<s:checkboxlist name="checkedOrgIds" list="allOrgList" listKey="id" listValue="cname" theme="custom"/>
												</div> 
											</div>
										</td>
									</tr>
									<tr>
										<td height="18" bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<div class="stylte3">
													<span style="color:red">*</span>角色 :</div>
												<div class="stylte2" style="padding-bottom: 10px;"><br/>
													<s:checkboxlist name="checkedRoleIds" list="allRoleList" listKey="id" listValue="roleCname" theme="custom"/>
												</div> 
											</div>
										</td>
									</tr>
									</form>
									<tr>
										<td bgcolor="#FFFFFF">
											<div align="center" class="STYLE1">
												<input type="image" src="${ctx}resources/images/submit.gif" onclick="checkFrom()">&nbsp;
												<input type="image" src="${ctx}resources/images/rest.gif">
											</div>
										</td>
									</tr>
								</table>
							</td>
							<td width="9" background="${ctx}resources/images/page/tab_16.gif">&nbsp;</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td height="29"><table width="100%" border="0" cellspacing="0"
						cellpadding="0">
						<tr>
							<td width="15" height="29">
								<img src="${ctx}resources/images/page/tab_20.gif" width="15" height="29" />
							</td>
							<td background="${ctx}resources/images/page/tab_21.gif"> </td>
							<td width="14">
								<img src="${ctx}resources/images/page/tab_22.gif" width="14" height="29" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
	</table>
</body>
</html>

